import React, { Component } from 'react'
import { Input } from 'antd';
import { Button} from 'antd'
import { BackTop } from 'antd';
import { withRouter } from 'react-router';
import axios from "axios";
import { BrowserRouter as Router, Route, Link } from "react-router-dom"
        export default class Newreturns extends Component {
          constructor(props) {
            super(props);
          }
          fn01(ev) {
            this.setState({
              [ev.target.date]: ev.target.value
             
        
            })
            console.log(this)
          }
          add() {
            let date = this.state.date;
            let number = this.state.number;
            let name = this.state.name;
            let cumulative = this.state.cumulative;
          
            let http = new XMLHttpRequest()
            http.open("get", `http://10.35.166.70:8080/add?date=${date}&number=${number}&name=${name}&cumulative=${cumulative}`)
            http.send()
            http.onreadystatechange = function () {
              if (http.readyState === 4) {
                if (http.responseText === "success") {
                  alert("新增成功")
                } else {
                  alert("新增失败")
                }
              }
            }
          }
            render(txt,record,index,props) {
            
                return (
                  <Router>
                    <div>
                            <div className="zui" style={{width:'100%',height:'100%',backgroundColor:'white',border:'1px solid #DCDFE8',borderRadius:'10px' }}>
            <div style={{borderBottom:'1px solid #DCDFE8'}}>
            <h1 style={{  fontSize: '21px',
    fontWeight: '700',
    color:' rgb(17, 10, 87)',marginLeft:'20px'}}>添加退货</h1>
        </div>
        <div style={{width:'45%',height:'100px',float:'left',marginLeft:'10px'}}><p>日期 *</p><Input  style={{borderRadius:'8px'}} onChange={(ev) => this.fn01(ev)}/></div>
        <div style={{width:'45%',height:'100px',float:'left',marginLeft:'10px'}}><p>参考编号 *</p><Input style={{borderRadius:'8px'}}placeholder="输入参考号"  onChange={(ev) => this.fn01(ev)} /></div>
        <div style={{width:'45%',height:'100px',float:'left',marginLeft:'10px'}}><p>顾客 *</p><Input style={{borderRadius:'8px'}}placeholder="测试账单"  onChange={(ev) => this.fn01(ev)} /></div>
        <div style={{width:'45%',height:'100px',float:'left',marginLeft:'10px'}}><p> 
累计 *</p><Input style={{borderRadius:'8px'}} placeholder="输入客户名称" onChange={(ev) => this.fn01(ev)} /></div>
        <div style={{width:'45%',height:'100px',float:'left',marginLeft:'10px'}}><p>订单税*</p><Input style={{borderRadius:'8px'}}placeholder="没有文字" /></div>
        <div style={{width:'45%',height:'100px',float:'left',marginLeft:'10px'}}><p>订单折扣</p><Input style={{borderRadius:'8px'}}placeholder="折扣" /></div>
        <div style={{width:'98%',height:'100px',float:'left',marginLeft:'10px'}}><p>船运*</p><Input style={{borderRadius:'8px'}}placeholder="船运" /></div>
        <div style={{width:'98%',height:'100px',float:'left',marginLeft:'10px'}}><p>附加文件</p><Input type='file' style={{borderRadius:'8px'}} style={{color:'#d9d9d9'}} /></div>
        <div style={{width:'98%',height:'100px',float:'left',marginLeft:'10px'}}><p>退货单*</p><Input style={{borderRadius:'8px'}}placeholder="退货单" /></div>
        <Link to="/#/admin/return"><Button  type="primary" size="samll"style={{}} onClick={()=>props.history.push('/admin/return')}  onClick={() => this.add()}> 增加退货 </Button>       &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</Link>
                <Button type="primary"danger="true" size="samll"style={{}} onClick={()=>props.history.push('/admin/return/Newreturns' )}
                > 重置</Button>
                <BackTop />

    <strong className="site-back-top-basic">  </strong>
        </div >
                    </div>
                    </Router>
                )
            }          
            
        }
        
         
